let g:leaderf_keymap = get(g:, 'leaderf_keymap', {    'name': '+leaderf',
            \               'b'    : [ 'LeaderfBuffer'              , 'buffer'          ],
            \               'c'    : [ 'LeaderfCommand'             , 'command'         ],
            \               'C'    : [ 'LeaderfColorscheme'         , 'colorscheme'     ],
            \               'f'    : [ 'LeaderfFile'                , 'file'            ],
            \               'F'    : [ 'LeaderfFunction'            , 'function'        ],
            \               'g'    : [ 'LeaderfRgInteractive'       , 'grep'            ],
            \               'h'    : [ 'LeaderfHelp'                , 'help'            ],
            \               'j'    : [ '<Plug>(leaderf-jump)'              , 'jumps'           ],
            \               'l'    : [ 'LeaderfLine'                , 'line'            ],
            \               'L'    : [ 'LeaderfLocList'             , 'location'        ],
            \               'q'    : [ 'LeaderfQuickFix'            , 'quickfix'        ],
            \               'r'    : [ 'LeaderfMru'                 , 'recent'          ],
            \               's'    : [ 'LeaderfSelf'                , 'leaderf'         ],
            \               'w'    : [ 'LeaderfWindow'              , 'window'          ],
            \ })


function! plugin#LeaderF#define() abort
    nmap  	<Plug>(leaderf-rg) 		    :Leaderf rg<CR>
    nmap  	<Plug>(leaderf-buffer) 	    :LeaderfBuffer<CR>
    nmap  	<Plug>(leaderf-command) 	:LeaderfCommand<CR>
    nmap  	<Plug>(leaderf-colorscheme) :LeaderfColorscheme<CR>
    nmap  	<Plug>(leaderf-file) 	    :LeaderfFile<CR>
    nmap  	<Plug>(leaderf-function) 	:LeaderfFunction<CR>
    nmap  	<Plug>(leaderf-grep) 	 	:LeaderfRgInteractive<CR>
    nmap  	<Plug>(leaderf-help) 	 	:LeaderfHelp<CR>
    nmap  	<Plug>(leaderf-line) 	    :LeaderfLine<CR>
    nmap  	<Plug>(leaderf-jump) 	    :Leaderf jumps<CR>
    nmap  	<Plug>(leaderf-self) 	    :LeaderfSelf<CR>
    nmap  	<Plug>(leaderf-recent) 	    :LeaderfMru<CR>
    nmap  	<Plug>(leaderf-quickfix) 	:LeaderfQuickFix<CR>
    nmap  	<Plug>(leaderf-location) 	:LeaderfLocList<CR>
    nmap  	<Plug>(leaderf-window) 	    :LeaderfWindow<CR>
endfunction

function! plugin#LeaderF#init() abort
	if exists('g:leaderf_loaded') && g:leaderf_loaded
		 :t g:leader_keymap = get(g:, 'leader_keymap', { 'name': '+leader' })
		let g:leader_keymap.l = g:leaderf_keymap
		call plugin#LeaderF#define()
		nnoremap <m-r>  :LeaderfMru<cr>
		nnoremap <m-b>  :LeaderfBuffer<cr>
		nnoremap <m-f>  :LeaderfFile<cr>
	endif
endfunction

function! plugin#LeaderF#load() abort
	if !exists('g:leaderf_loaded')
		packadd LeaderF
	endif
	return exists('g:leaderf_loaded')
endfunction
